﻿using System;
using System.Collections.Generic;

namespace RazakiSite
{
    public partial class Default : BasePage
    {

        private string Url
        {
            get { return UtilitiesUI.GetSimpleQueryString<string>("url"); }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            ConfigControls();
        }

        protected override void ConfigControls()
        {

            if (Properties.Settings.Default.UnderConstruction)
            {
                Response.Redirect("~/PagesPublic/UnderConstruction.htm");
            }

            string redirectUrl;

            if (!string.IsNullOrWhiteSpace(Url))
            {
                switch (Url)
                {
                    //case "order":
                    //    redirectUrl = string.Format("~/PagesPublic/Order.aspx{0}",
                    //                                UtilitiesUI.SetQueryString(new Dictionary<string, string> { { "messageype", "order" } }));
                    //    Response.Redirect(redirectUrl);
                    //    break;

                    case "offer":
                        redirectUrl = string.Format("~/PagesPublic/Order.aspx{0}",
                                                    UtilitiesUI.SetQueryString(new Dictionary<string, string> { { "messageype", "offer" } }));
                        Response.Redirect(redirectUrl);
                        break;
                }
            }

            redirectUrl = "~/PagesPublic/Home.aspx";
            Server.Transfer(redirectUrl);
        }

    }
}